﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using DiscountSharing.LocalModels;
using System.Windows.Media.Imaging;

namespace DiscountSharing.LocalControls
{
    public partial class Profile : UserControl
    {
        private Friend _currentFriend;
        public Friend CurrentFriend 
        {
            get { return _currentFriend; } 
            set
            {
                _currentFriend = value;
                FriendImage.Source = new BitmapImage(new Uri(_currentFriend.LargePic));
                int counts = 0;
                int likes = 0;
                foreach (Post p in ((App)App.Current).Posts)
                {
                    if (p.ID == _currentFriend.ID)
                    {
                        counts++;
                    }
                }
                FriendDiscounts.Text = String.Format("Posted Discounts: {0}", counts.ToString());
                FriendLikes.Text = String.Format("Likes Counter: {0}", likes.ToString());
            } 
        }

        public Profile()
        {
            InitializeComponent();
        }
    }
}
